home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14720 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: rocannon.cam.harlequin.co.uk!markt
  2. From: markt@harlqn.co.uk (Mark Tillotson)
  3. Newsgroups: comp.object,comp.lang.c++,comp.lang.java
  4. Subject: Re: Java: What's the Big Deal?  (GC)
  5. Date: 01 Apr 96 20:02:03 GMT
  6. Organization: Harlequin Limited, Cambridge, England
  7. Message-ID: <MARKT.96Apr1200203@atlas.harlqn.co.uk>
  8. References: <4jk4ee$7ri@newsbf02.news.aol.com> <1996Apr1.155416.12816@schbbs.mot.com>
  9. NNTP-Posting-Host: atlas
  10. In-reply-to: shang@corp.mot.com's message of Mon, 1 Apr 1996 15:54:16 GMT
  11.  
  12. shang@corp.mot.com (David L. Shang) wrote:
  13. > The more a program depends on GC, the more likely it will exhaust memory;
  14. > because the storage is collected only when all its references are
  15. > no longer valid, not at the time when all its references are no longer
  16. > used. 
  17. In complex software this is not true...  explicit management of
  18. storage places such a burden on the programmer that either security is
  19. compromised (catastrophic bugs) or space leaks occur (that a GC would
  20. easily have caught).  In a GC-based system you only have to debug the
  21. GC, not every single program that calls free() !!
  22.  
  23. > Be careful, never make a variable's lifetime unecessarily longer
  24. > than the required.
  25. This advice for avoiding space leaks happens to be valid _whether or
  26. not_ automatic GC is in operation!
  27.  
  28. > With Java's array, memory will be smashed into millions of small
  29. > pieces. Here is a brief comparison:
  30.  
  31. <array of struct of 3 floats example omitted>
  32.  
  33. On many machines one load instruction is cheaper than multiplying an
  34. index by 3, so Java's approach is actually faster (other things being
  35. equal)... Object allocation rarely costs a significant proportion of
  36. execution time, unless the application fails to do anything useful
  37. with what it allocates!!
  38.  
  39. I suggest investigating the GC FAQ at 
  40. http://www.centerline.com/people/chase/GC/GC-faq.html
  41.  
  42. __Mark
  43. [ markt@harlequin.co.uk | http://www.harlequin.co.uk/ | +44 1223 873829   ]
  44. [ homepage http://www.hal.com/services/juggle/home/markt@harlequin.co.uk/ ]
  45.